package cn.tedu.fengyuback.personal.controller;

import cn.tedu.fengyuback.base.response.JsonResult;
import cn.tedu.fengyuback.personal.pojo.dto.FavoritesQuery;
import cn.tedu.fengyuback.personal.pojo.vo.ArticlesVO;
import cn.tedu.fengyuback.personal.service.FavoritesService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@Slf4j
@RestController
@RequestMapping(value = "/v1/personal/favorite")
public class FavoritesController {
    @Autowired
    private FavoritesService favoritesService;

    /**
     * 查询收藏的文章
     * @param favoritesQuery
     * @return
     */
    @GetMapping("select")
    public JsonResult selectFavorite(FavoritesQuery favoritesQuery) {
        log.debug("查询收藏文章的参数：{}", favoritesQuery);
        List<ArticlesVO> list = favoritesService.selectFavorite(favoritesQuery);
        return JsonResult.ok(list);
    }
}
